var express = require('express');
var router = express.Router();

var crypto = require('crypto'),
User = require('../modles/user.js');


router.get(['/', '/index'], function (req, res, next){
    res.render('register',{
    title: '注册页面'
  });
});

router.post(['/', '/index'], function (req, res, next){
     var name = req.body.name,
         password =  req.body.password,
         password_re = req.body['password-repeat'];
         console.log(password_re)
         //检验用户两次输入的密码是否一致
         if (password_re != password) {
            req.flash('error','两次密码不一致');
            return res.redirect('./reg');  //返回注册页
         }
});

module.exports = router;
